#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int evalRPN(vector<string>& tokens) {
        stack<int> st1;
        int sum = 0;
        for (auto& e : tokens)
        {
            if (e == "+" || e == "-" || e == "*" || e == "/")
            {
                int right = st1.top();
                st1.pop();
                int left = st1.top();
                st1.pop();
                switch (e[0])
                {
                case '+':
                    st1.push(left + right);
                    break;
                case '-':
                    st1.push(left - right);
                    break;
                case '*':
                    st1.push(left * right);
                    break;
                case '/':
                    st1.push(left / right);
                    break;
                }
            }
            else
                st1.push(stoi(e));
        }

        return st1.top();
    }
};